package com.vakitdaraliyor.www.servlet;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.vakitdaraliyor.www.dao.CountdownDao;
import com.vakitdaraliyor.www.entity.Countdown;


@WebServlet("/countDown")
public class ListeyiCek extends HttpServlet {

	private static final long serialVersionUID = 1L;
	@EJB
	private CountdownDao countdownDao;
	private List<Countdown> gerisayimListesi = new ArrayList<Countdown>();
	
	public ListeyiCek() {
		
	}

	protected void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
		gerisayimListesi = countdownDao.hepsiniGetir();
		request.setAttribute("gerisayimListesi", gerisayimListesi);
		request.getRequestDispatcher("/anasayfa.jsp").forward(request,response);
	}

	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

	public List<Countdown> getGerisayimListesi() {
		return gerisayimListesi;
	}

	public void setGerisayimListesi(List<Countdown> gerisayimListesi) {
		this.gerisayimListesi = gerisayimListesi;
	}

	
}